//app.js
App({
  globalData: {
    username: '',
    // url:"http://47.93.37.84:8080/",
    url: "http://localhost:8080/",
    autoRemind: true,
    clock: 0,
    selfRemind: [],
    remind: 0,
  },
  
  /**
   * 接收医生端小程序传递的值
   */
  onLaunch: function (options) {
    
    console.log(this.globalData.username)
    //this.globalData.username = options.username
    var that=this
    wx.getStorage({
      key: 'autoRemind',
      success(res) {
        that.globalData.autoRemind=res.data
      },
      fail(res){
       wx.setStorage({
         key: 'autoRemind',
         data: true,
       })
      }
    })

    this.globalData.clock = setInterval(
      function() {
        if(getApp().globalData.autoRemind=='0'||getApp().globalData.autoRemind==false) return;
        wx.showModal({
          title: '您已经使用该小程序三十分钟',
          content: '站起来，活动活动身子吧!',
          showCancel: false,
          cancelText: "否", //默认是“取消”
          cancelColor: 'skyblue', //取消文字的颜色
          confirmText: "我知道了", //默认是“确定”
          confirmColor: 'skyblue', //确定文字的颜色
          success: function(sm) {
            if (sm.confirm) {
            } else if (sm.cancel) {}
          }
        })
      }, 300000);
  },
})